package com.songlanyun.modules.sharerecord.controller.api;

import com.songlanyun.common.annotation.RepeatSubmit;
import com.songlanyun.common.utils.R;
import com.songlanyun.modules.account.controller.common.AbstractApiController;
import com.songlanyun.modules.sharerecord.model.SystemShareOpenRecordDTO;
import com.songlanyun.modules.sharerecord.service.SystemShareOpenRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * 记录会员打开分享连接记录
 *
 * @author zx
 * @date 2021年3月4日 14:52:06
 */
@RestController
@RequestMapping("api/share/record")
public class SystemShareOpenRecordApiController extends AbstractApiController {
    @Autowired
    private SystemShareOpenRecordService systemShareOpenRecordService;

    /**
     * 保存
     */
    @PostMapping("/save")
    @RepeatSubmit(value = "3")
    public R add(@RequestBody SystemShareOpenRecordDTO dto){
        Long userId = getUserId(false);
        if(userId<=0) {
            return R.ok();
        }
        dto.setClient(getClient());
        dto.setUserId(userId);
		systemShareOpenRecordService.add(dto);
        return R.ok();
    }
}
